package com.kevin.elasticjob.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.kevin.elasticjob.dao.UserMapper;
import com.kevin.elasticjob.model.User;
import com.kevin.elasticjob.service.UserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Kevin Liu
 * @date 2020/7/31 下午4:18
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Override
    public String getWrapper(User user) {
        return getBaseMapper().selectNameById(user.getId());
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean insert(User user) {
        save(user);

       return true;
    }

    @Transactional
    public void pass(User user) {
        save(user);
        int x = 1/0;
    }
}
